package com.example.Windturbine.Listener;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.example.Windturbine.Controller.ViewObject.Excel.QAExcel;
import com.example.Windturbine.Controller.ViewObject.Excel.TransportExcel;
import com.example.Windturbine.Dao.QADOMapper;
import com.example.Windturbine.DataObject.QADO;
import com.example.Windturbine.Service.MaterialService;
import org.springframework.beans.BeanUtils;

/**
 * @Author 丁永新
 * @Date 2022/2/7
 */
public class ExcelQAListener extends AnalysisEventListener<QAExcel> {


    QADOMapper qadoMapper;

    public ExcelQAListener(QADOMapper qadoMapper) {
        this.qadoMapper = qadoMapper;
    }

    @Override
    public void invoke(QAExcel qaExcel, AnalysisContext analysisContext) {
        QADO qado=new QADO();
        BeanUtils.copyProperties(qaExcel,qado);
        qadoMapper.insertSelective(qado);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
